package com.bwie.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @program: day0423-pxx
 * @ClassName GoodSearch
 * @description:
 * @author: 段阳
 * @create: 2024-05-08 20:12
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "es_goods",shards = 1,replicas = 1)
public class Goods {

    @Id
    private Long  id;//spuId
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String all ; //所有需要被搜索的信息，包含标题，分类，甚至品牌
    @Field(type = FieldType.Keyword,index = false)
    private String subTitle; //副标题

    private Long  brandId;//品牌id
    private Long  cid1;//商品分类 1
    private Long  cid2;//商品分类 2
    private Long  cid3;//商品分类 3
    private Date createTime;//创建时间

    private List<Long> price ;//价格

    @Field(type = FieldType.Keyword,index = false)
    private String skus; // list<sku>信息 json结构

    //可以搜索的规格参数，
    /**
     *
     * {
     *     "specs":{
     *         "内存"：[4G,6G],
     *         “颜色":"红色"
     *
     *     }
     * }
     *
     * specs.内存：[4G,6G]
     * specs.颜色：红色
     *
     *
     *
     */
    private Map<String, Object> specs;//可以搜索的规格参数，key是参数名，值参数值
}